package com.jfinal.weixin.demo;

import com.jfinal.kit.PropKit;

public class Constants {
	
	public static final String MailReg = "^([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)+[\\.][A-Za-z]{2,3}([\\.][A-Za-z]{2})?$"; //邮箱正则
	public static final String PhoneReg = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";//手机正则
	
	public static final String UPLOAD_DIR = "upload";
    public static final String UPLOAD_DIR_AVATAR = "avatar";
	
    public static final String ERROR = "error";
    //用户
    public static final String USER_COOKIE = "user_token_v2";
    public static final String USER_SESSION = "user";
    public static final int TOKEN_INVALID_TIME = 10;//token 的有效时间
    public static final String BEFORE_URL = "before_url";
    public static final String ADMIN_BEFORE_URL = "admin_before_url";
    //管理员信息
    public static final String COOKIE_ADMIN_TOKEN = "admin_user_token";
    public static final String SESSION_ADMIN_USER = "admin_user";
    public static final String SESSION_ADMIN_USERNAME = "admin_username";
    public static final int ADMIN_TOKEN_INVALID_TIME = 60 * 60;//后台token 的时间

    public static final String OP_ERROR_MESSAGE = "非法操作";
    public static final String DELETE_FAILURE = "删除失败";

	
	 // 缓存名称
	public static final String SHIROCACHE = "shirocache";
	
	 //role
    public static final String ROLECACHEKEY = "rolecachekey";
    public static final String PERMISSIONCACHEKEY = "permissioncachekey";
	
    /**
     * 验证码有效期，单位/分钟
     */
    public static final int VALID_AVAILABLE_TIME = 3;
    
	public static String getBaseUrl() {
        return PropKit.get("base.url");
    }
	
	public static String getSiteTitle() {
		return PropKit.get("site_title");
	}
	
	public static final String wx_app_id = "wx5e1f7402eef80131";
	public static final String wx_app_sercret = "02c657aed13439bbb85fb7158ed4b89e";
	public static final String wx_authorize_URL = "https://open.weixin.qq.com/connect/oauth2/authorize";
	public static final String wx_accessToken_URL = "https://api.weixin.qq.com/sns/oauth2/access_token";
	public static final String wx_user_info_URL = "https://api.weixin.qq.com/sns/userinfo";
	
	
	public static class RequestMethod {
        public static final String GET = "get";
        public static final String POST = "post";
    }
	public static class ResultCode {
        public static final String SUCCESS = "200";
        public static final String FAILURE = "201";
    }

    public static class ResultDesc {
        public static final String SUCCESS = "success";
        public static final String FAILURE = "error";
    }
    

    public static class CacheName {
        public static final String SECTIONLIST = "section_list";
        public static final String SECTIONSHOWLIST = "section_show_list";
        public static final String LINKLIST = "link_list";
        public static final String DEFAULTSECTION = "default_section";
    }

    public static class CacheKey {
        public static final String SECTIONLISTKEY = "section_list_key";
        public static final String SECTIONSHOWLISTKEY = "section_show_list_key";
        public static final String LINKLISTKEY = "link_list_key";
        public static final String DEFAULTSECTIONKEY = "default_section_key";
    }

    public static class ThirdLogin {
        public static final String QQ = "qq";
        public static final String SINA = "sina";
        public static final String WECHAT = "wechat";
    }

    public static class ValiCodeType {
        public static final String FORGET_PWD = "forgetpwd";
        public static final String REG = "reg";
    }
    
}
